// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取部门树 GET /api/department/tree */
export async function queryDepartTree(options?: { [key: string]: any }) {
  return request<API.TreeNodeItem[]>('/api/department/tree', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取部门列表 GET /api/department */
export async function queryDepartment(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/department', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新部门 PUT /api/department */
export async function updateDepartment(body: API.DepartmentItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/department', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 添加部门 POST /api/department */
export async function addDepartment(body: API.DepartmentItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/department', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id删除部门 DELETE /api/department */
export async function removeDepartment(
  params: {
    // query
    /** 部门Id */
    departmentId?: number;
  },
  options?: { [key: string]: any },
) {
  return request<Record<string, any>>('/api/department', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 删除部门DELETE  */
export async function batchRemoveDepartment(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/department/batchdel', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}
